#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
void merge(int* nums1, int nums1Size, int m, int* nums2, int nums2Size, int n)
{
	int i = 0;
	int j = 0;
	int k = 0;
	int tmp[200] = { 0 };
	for (i = 0; i < m; i++)
		tmp[i] = nums1[i];
	i = 0;
	while (i < m && j < n)
	{
		if (tmp[i] <= nums2[j])
			nums1[k++] = tmp[i++];
		else if (tmp[i] > nums2[j])
			nums1[k++] = nums2[j++];
	}
	for (; k < m + n; k++)
	{
		if (i == m )
			nums1[k] = nums2[j++];
		else if (j == n )
			nums1[k] = tmp[++i];

	}
}
int majorityElement(int* nums, int numsSize);
int main()
{
	int arr1[10] = { 8,8,7,7,7 };
	int m = 5;
	m = majorityElement(arr1, m);
	printf("%d", m);
	return 0;
}

int majorityElement(int* nums, int numsSize)
{
	int count = 1;
	int i = 0;
	int k = nums[0];
	for (i = 1; i < numsSize; i++)
	{
		if (nums[i] != k)
			count--;
		else
			count++;
		if (count++ == 0)
			k = nums[i];

	}
}